import type { Module, ActionContext } from 'vuex'
import type { AxiosResponse } from 'axios'
// import type { streetManagementStateType } from './typings'
import {
  getAssetHomeWorkAreaList,
  getAssetHomeOptionsBar,
  getAssetHomeMapSpecialTenant,
  getAssetHomeBaseDataByModuleId,
  getAssetHomeBaseDataByModuleIdStationGisApi,
  getAssetHomeBaseDataByModuleIdWhole,
  getAssetHomePowerDistributionFacilities,
  getAssetHomePowerSearchAssetBaseStation,
  getAssetHomePowerSearchAssetBaseStationStationGisApi,
  getAssetHomeOverlapPointList,
  getAssetHomePopoverInfoDataById,
  getAssetHomePopoverInfoDataByIdStationGisApi
} from '~/api/assetManagement/assetHome'
// import { filterValueEnum } from '~/utils/util'

const assetHome: Module<Record<string, any>, Record<string, any>> = {
  namespaced: true,
  state: {},
  getters: {},
  mutations: {},
  actions: {
    // 查询资产首页当前租户配置的工区列表
    async GetAssetHomeWorkAreaList<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomeWorkAreaList(params).then((res: AxiosResponse) => res?.data)
    },
    // 查询租户专题图的资产组件图标(按钮操作栏)
    async GetAssetHomeOptionsBar() {
      return await getAssetHomeOptionsBar({ specialCode: 'asset_home' }).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 查询资产首页地图所需加载的租户配置的专题图数据
    async GetAssetHomeMapSpecialTenant() {
      return await getAssetHomeMapSpecialTenant({ specialCode: 'asset_home' }).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 搜索资产组件id查询数据
    async GetAssetHomeBaseDataByModuleId<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomeBaseDataByModuleId(params).then((res: AxiosResponse) => res?.data)
    },
    // 搜索资产组件id查询数据（勤电）
    async GetAssetHomeBaseDataByModuleIdStationGisApi<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomeBaseDataByModuleIdStationGisApi(params).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 查询所有数据
    async GetAssetHomeBaseDataByModuleIdWhole<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomeBaseDataByModuleIdWhole(params).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 根据设施名称关键字模糊搜索匹配的配电设施列表
    async GetAssetHomePowerDistributionFacilities<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomePowerDistributionFacilities(params).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 根据设施名称关键字模糊搜索匹配的建设规划列表
    async GetAssetHomePowerSearchAssetBaseStation<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomePowerSearchAssetBaseStation(params).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 根据设施名称关键字模糊搜索匹配的建设规划列表(勤电)
    async GetAssetHomePowerSearchAssetBaseStationStationGisApi<S, T>(
      _: ActionContext<S, T>,
      params: T
    ) {
      return await getAssetHomePowerSearchAssetBaseStationStationGisApi(params).then(
        (res: AxiosResponse) => res?.data
      )
    },
    // 查询当前坐标点有无重叠的点
    async GetAssetHomeOverlapPointList<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomeOverlapPointList(params).then((res: AxiosResponse) => res?.data)
    },
    // 查询点击坐标点的信息弹框用到的数据
    async GetAssetHomePopoverInfoDataById<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomePopoverInfoDataById(params).then((res: AxiosResponse) => res?.data)
    },
    // 查询点击坐标点的信息弹框用到的数据(勤电)
    async GetAssetHomePopoverInfoDataByIdStationGisApi<S, T>(_: ActionContext<S, T>, params: T) {
      return await getAssetHomePopoverInfoDataByIdStationGisApi(params).then(
        (res: AxiosResponse) => res?.data
      )
    }
  }
}

export default assetHome
